riscv: Add qspinlock support #92
Merged
sterling-teng merged 7 commits intoRVCK-Project:rvck-6.6from Sep 7, 2025
Merged
Conversation
Collaborator
|
/check |
|
开始测试 |
|
check patch done. log: https://jenkins.oerv.ac.cn/job/rvck-pipeline/job/check-patch/120/consoleFull |
|
Kernel build success! |
|
kunit test done. log:https://jenkins.oerv.ac.cn/job/rvck-pipeline/job/kunit-test/126/consoleFull |
|
Lava check fail! log: https://jenkins.oerv.ac.cn/job/rvck-pipeline/job/rvck-lava-trigger/150/consoleFull, result url: https://lava.oerv.ac.cn/results/444/0_rvck_common-test_qemu |
Collaborator
|
/check |
|
开始测试 |
|
kunit test done. log:https://jenkins.oerv.ac.cn/job/rvck-pipeline/job/kunit-test/144/consoleFull |
|
Lava check done! result url: https://lava.oerv.ac.cn/results/518/0_rvck_common-test_qemu |
1cdcb55 to
bfade98
Compare
mainline inclusion from mainline-v6.6-rc2 commit c6f4a90 category: feature bugzilla: RVCK-Project#90 -------------------------------- The arch_spin_value_unlocked() of ticket-lock would cause the compiler to generate inefficient asm code in riscv architecture because of unnecessary memory access to the contended value. Before the patch: void lockref_get(struct lockref *lockref) { 78: fd010113 add sp,sp,-48 7c: 02813023 sd s0,32(sp) 80: 02113423 sd ra,40(sp) 84: 03010413 add s0,sp,48 0000000000000088 <.LBB296>: CMPXCHG_LOOP( 88: 00053783 ld a5,0(a0) After the patch: void lockref_get(struct lockref *lockref) { CMPXCHG_LOOP( 78: 00053783 ld a5,0(a0) After the patch, the lockref_get() could get in a fast path instead of the function's prologue. This is because ticket lock complex logic would limit compiler optimization for the spinlock fast path, and qspinlock won't. The caller of arch_spin_value_unlocked() could benefit from this change. Currently, the only caller is lockref. Signed-off-by: Guo Ren <guoren@kernel.org> Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Waiman Long <longman@redhat.com> Acked-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20230908154339.3250567-1-guoren@kernel.org Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit 6116e22 category: feature bugzilla: RVCK-Project#90 -------------------------------- The current fully-ordered cmpxchgXX() implementation results in: amocas.X.rl a5,a4,(s1) fence rw,rw This provides enough sync but we can actually use the following better mapping instead: amocas.X.aqrl a5,a4,(s1) Suggested-by: Andrea Parri <andrea@rivosinc.com> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-7-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit f7bd2be category: feature bugzilla: RVCK-Project#90 -------------------------------- Now that Zacas is supported in the kernel, let's use the double word atomic version of amocas to improve the SLUB allocator. Note that we have to select fixed registers, otherwise gcc fails to pick even registers and then produces a reserved encoding which fails to assemble. Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-8-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit 97ddab7 category: feature bugzilla: RVCK-Project#90 -------------------------------- This adds runtime support for Zabha in xchg8/16() operations. Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-9-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit cbe82e1 category: feature bugzilla: RVCK-Project#90 -------------------------------- The arch_spinlock_t of qspinlock has contained the atomic_t val, which satisfies the ticket-lock requirement. Thus, unify the arch_spinlock_t into qspinlock_types.h. This is the preparation for the next combo spinlock. Reviewed-by: Leonardo Bras <leobras@redhat.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/linux-riscv/CAK8P3a2rnz9mQqhN6-e0CGUUv9rntRELFdxt_weiD7FxH7fkfQ@mail.gmail.com/ Signed-off-by: Guo Ren <guoren@kernel.org> Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-10-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit 22c3332 category: feature bugzilla: RVCK-Project#90 -------------------------------- Add a separate ticket-lock.h to include multiple spinlock versions and select one at compile time or runtime. Reviewed-by: Leonardo Bras <leobras@redhat.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/linux-riscv/CAK8P3a2rnz9mQqhN6-e0CGUUv9rntRELFdxt_weiD7FxH7fkfQ@mail.gmail.com/ Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-11-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
mainline inclusion from mainline-v6.12 commit ab83647 category: feature bugzilla: RVCK-Project#90 -------------------------------- In order to produce a generic kernel, a user can select CONFIG_COMBO_SPINLOCKS which will fallback at runtime to the ticket spinlock implementation if Zabha or Ziccrse are not present. Note that we can't use alternatives here because the discovery of extensions is done too late and we need to start with the qspinlock implementation because the ticket spinlock implementation would pollute the spinlock value, so let's use static keys. This is largely based on Guo's work and Leonardo reviews at [1]. Link: https://lore.kernel.org/linux-riscv/20231225125847.2778638-1-guoren@kernel.org/ [1] Signed-off-by: Guo Ren <guoren@kernel.org> Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Andrea Parri <parri.andrea@gmail.com> Link: https://lore.kernel.org/r/20241103145153.105097-14-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Contributor
|
backport自6.12,物理机boot测试通过,合并。 |
WangJia-UR
added a commit
to WangJia-UR/rvck
that referenced
this pull request
Oct 11, 2025
community inclusion category: feature bugzilla: RVCK-Project#71 ------------------------------------------------- 1. Add ARCH_ULTRARISC and PINCTRL_ULTRARISC_DP1000 support 2. MODVERSIONS is selectd by default and does not require explicit configuration. 3. Set CMA_SIZE_MBYTES to 256; otherwise, the system may encounter errors during initialization: ``` [ 5.206815] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 [ 5.243730] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 ``` On the UltraRISC M-ATX, CMA memory usage: ``` $ sudo cat /proc/meminfo | grep -i cma CmaTotal: 262144 kB CmaFree: 184504 kB ``` 4. Disable DEFERRED_STRUCT_PAGE_INIT, otherwise, the system may panic during initialization: ``` [ 0.000000] Falling back to deprecated "riscv,isa" [ 0.000000] riscv: base ISA extensions acdfhim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 0.000000] Oops [RVCK-Project#1] [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G T 6.6.103+ RVCK-Project#92 [ 0.000000] Hardware name: ultrarisc,dp1000 (DT) [ 0.000000] epc : __patch_insn_write+0x1a2/0x30e [ 0.000000] ra : __patch_insn_write+0x106/0x30e [ 0.000000] epc : ffffffff8000725c ra : ffffffff800071c0 sp : ffffffff81c03cb0 [ 0.000000] gp : ffffffff81e30150 tp : ffffffff81c121c0 t0 : 45203a7663736972 [ 0.000000] t1 : 0000000000000072 t2 : 4c45203a76637369 s0 : ffffffff81c03d00 [ 0.000000] s1 : ffffaf83f27a0100 a0 : 0000000000000001 a1 : 0000000000000001 [ 0.000000] a2 : 0000000000476804 a3 : 000000000001feff a4 : 0000000000001fe8 [ 0.000000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 0000000000000010 [ 0.000000] s2 : ffffffff8000415e s3 : 0000000000000004 s4 : ffffffff80004418 [ 0.000000] s5 : 0000000000000162 s6 : 000000000000015e s7 : ffffffff81e3c5c0 [ 0.000000] s8 : ffffffff8000415e s9 : ffffffffff16c7cc s10: 0000000000000018 [ 0.000000] s11: ffffaf83ffa0f7c0 t3 : ffffffff81e4ea77 t4 : ffffffff81e4ea77 [ 0.000000] t5 : ffffffff81e4ea78 t6 : ffffffff81c03a78 [ 0.000000] status: 0000000200000100 badaddr: 0000000000000000 cause: 000000000000000d [ 0.000000] [<ffffffff8000725c>] __patch_insn_write+0x1a2/0x30e [ 0.000000] [<ffffffff80007480>] patch_text_nosync+0x4c/0x8a [ 0.000000] [<ffffffff80003eb0>] riscv_cpufeature_patch_func+0xcc/0x12a [ 0.000000] [<ffffffff80003126>] _apply_alternatives+0x90/0x9c [ 0.000000] [<ffffffff80c03394>] apply_boot_alternatives+0x32/0x11a [ 0.000000] [<ffffffff80c04cba>] setup_arch+0x5f4/0x698 [ 0.000000] [<ffffffff80c0085c>] start_kernel+0x92/0x7e4 [ 0.000000] Code: 9359 cb89 070e 97ba 639c c789 f693 07f6 0696 97b6 (639c) 0513 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- ``` Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
sterling-teng
pushed a commit
that referenced
this pull request
Nov 3, 2025
community inclusion category: feature bugzilla: #71 ------------------------------------------------- 1. Add ARCH_ULTRARISC and PINCTRL_ULTRARISC_DP1000 support 2. MODVERSIONS is selectd by default and does not require explicit configuration. 3. Set CMA_SIZE_MBYTES to 256; otherwise, the system may encounter errors during initialization: ``` [ 5.206815] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 [ 5.243730] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 ``` On the UltraRISC M-ATX, CMA memory usage: ``` $ sudo cat /proc/meminfo | grep -i cma CmaTotal: 262144 kB CmaFree: 184504 kB ``` 4. Disable DEFERRED_STRUCT_PAGE_INIT, otherwise, the system may panic during initialization: ``` [ 0.000000] Falling back to deprecated "riscv,isa" [ 0.000000] riscv: base ISA extensions acdfhim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 0.000000] Oops [#1] [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G T 6.6.103+ #92 [ 0.000000] Hardware name: ultrarisc,dp1000 (DT) [ 0.000000] epc : __patch_insn_write+0x1a2/0x30e [ 0.000000] ra : __patch_insn_write+0x106/0x30e [ 0.000000] epc : ffffffff8000725c ra : ffffffff800071c0 sp : ffffffff81c03cb0 [ 0.000000] gp : ffffffff81e30150 tp : ffffffff81c121c0 t0 : 45203a7663736972 [ 0.000000] t1 : 0000000000000072 t2 : 4c45203a76637369 s0 : ffffffff81c03d00 [ 0.000000] s1 : ffffaf83f27a0100 a0 : 0000000000000001 a1 : 0000000000000001 [ 0.000000] a2 : 0000000000476804 a3 : 000000000001feff a4 : 0000000000001fe8 [ 0.000000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 0000000000000010 [ 0.000000] s2 : ffffffff8000415e s3 : 0000000000000004 s4 : ffffffff80004418 [ 0.000000] s5 : 0000000000000162 s6 : 000000000000015e s7 : ffffffff81e3c5c0 [ 0.000000] s8 : ffffffff8000415e s9 : ffffffffff16c7cc s10: 0000000000000018 [ 0.000000] s11: ffffaf83ffa0f7c0 t3 : ffffffff81e4ea77 t4 : ffffffff81e4ea77 [ 0.000000] t5 : ffffffff81e4ea78 t6 : ffffffff81c03a78 [ 0.000000] status: 0000000200000100 badaddr: 0000000000000000 cause: 000000000000000d [ 0.000000] [<ffffffff8000725c>] __patch_insn_write+0x1a2/0x30e [ 0.000000] [<ffffffff80007480>] patch_text_nosync+0x4c/0x8a [ 0.000000] [<ffffffff80003eb0>] riscv_cpufeature_patch_func+0xcc/0x12a [ 0.000000] [<ffffffff80003126>] _apply_alternatives+0x90/0x9c [ 0.000000] [<ffffffff80c03394>] apply_boot_alternatives+0x32/0x11a [ 0.000000] [<ffffffff80c04cba>] setup_arch+0x5f4/0x698 [ 0.000000] [<ffffffff80c0085c>] start_kernel+0x92/0x7e4 [ 0.000000] Code: 9359 cb89 070e 97ba 639c c789 f693 07f6 0696 97b6 (639c) 0513 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- ``` Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
sterling-teng
pushed a commit
that referenced
this pull request
Nov 30, 2025
community inclusion category: feature bugzilla: #71 ------------------------------------------------- 1. Add ARCH_ULTRARISC and PINCTRL_ULTRARISC_DP1000 support 2. MODVERSIONS is selectd by default and does not require explicit configuration. 3. Set CMA_SIZE_MBYTES to 256; otherwise, the system may encounter errors during initialization: ``` [ 5.206815] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 [ 5.243730] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 ``` On the UltraRISC M-ATX, CMA memory usage: ``` $ sudo cat /proc/meminfo | grep -i cma CmaTotal: 262144 kB CmaFree: 184504 kB ``` 4. Disable DEFERRED_STRUCT_PAGE_INIT, otherwise, the system may panic during initialization: ``` [ 0.000000] Falling back to deprecated "riscv,isa" [ 0.000000] riscv: base ISA extensions acdfhim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 0.000000] Oops [#1] [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G T 6.6.103+ #92 [ 0.000000] Hardware name: ultrarisc,dp1000 (DT) [ 0.000000] epc : __patch_insn_write+0x1a2/0x30e [ 0.000000] ra : __patch_insn_write+0x106/0x30e [ 0.000000] epc : ffffffff8000725c ra : ffffffff800071c0 sp : ffffffff81c03cb0 [ 0.000000] gp : ffffffff81e30150 tp : ffffffff81c121c0 t0 : 45203a7663736972 [ 0.000000] t1 : 0000000000000072 t2 : 4c45203a76637369 s0 : ffffffff81c03d00 [ 0.000000] s1 : ffffaf83f27a0100 a0 : 0000000000000001 a1 : 0000000000000001 [ 0.000000] a2 : 0000000000476804 a3 : 000000000001feff a4 : 0000000000001fe8 [ 0.000000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 0000000000000010 [ 0.000000] s2 : ffffffff8000415e s3 : 0000000000000004 s4 : ffffffff80004418 [ 0.000000] s5 : 0000000000000162 s6 : 000000000000015e s7 : ffffffff81e3c5c0 [ 0.000000] s8 : ffffffff8000415e s9 : ffffffffff16c7cc s10: 0000000000000018 [ 0.000000] s11: ffffaf83ffa0f7c0 t3 : ffffffff81e4ea77 t4 : ffffffff81e4ea77 [ 0.000000] t5 : ffffffff81e4ea78 t6 : ffffffff81c03a78 [ 0.000000] status: 0000000200000100 badaddr: 0000000000000000 cause: 000000000000000d [ 0.000000] [<ffffffff8000725c>] __patch_insn_write+0x1a2/0x30e [ 0.000000] [<ffffffff80007480>] patch_text_nosync+0x4c/0x8a [ 0.000000] [<ffffffff80003eb0>] riscv_cpufeature_patch_func+0xcc/0x12a [ 0.000000] [<ffffffff80003126>] _apply_alternatives+0x90/0x9c [ 0.000000] [<ffffffff80c03394>] apply_boot_alternatives+0x32/0x11a [ 0.000000] [<ffffffff80c04cba>] setup_arch+0x5f4/0x698 [ 0.000000] [<ffffffff80c0085c>] start_kernel+0x92/0x7e4 [ 0.000000] Code: 9359 cb89 070e 97ba 639c c789 f693 07f6 0696 97b6 (639c) 0513 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- ``` Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
sterling-teng
pushed a commit
that referenced
this pull request
Dec 31, 2025
community inclusion category: feature bugzilla: #71 ------------------------------------------------- 1. Add ARCH_ULTRARISC and PINCTRL_ULTRARISC_DP1000 support 2. MODVERSIONS is selectd by default and does not require explicit configuration. 3. Set CMA_SIZE_MBYTES to 256; otherwise, the system may encounter errors during initialization: ``` [ 5.206815] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 [ 5.243730] cma: cma_alloc: reserved: alloc failed, req-size: 2 pages, ret: -12 ``` On the UltraRISC M-ATX, CMA memory usage: ``` $ sudo cat /proc/meminfo | grep -i cma CmaTotal: 262144 kB CmaFree: 184504 kB ``` 4. Disable DEFERRED_STRUCT_PAGE_INIT, otherwise, the system may panic during initialization: ``` [ 0.000000] Falling back to deprecated "riscv,isa" [ 0.000000] riscv: base ISA extensions acdfhim [ 0.000000] riscv: ELF capabilities acdfim [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 [ 0.000000] Oops [#1] [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G T 6.6.103+ #92 [ 0.000000] Hardware name: ultrarisc,dp1000 (DT) [ 0.000000] epc : __patch_insn_write+0x1a2/0x30e [ 0.000000] ra : __patch_insn_write+0x106/0x30e [ 0.000000] epc : ffffffff8000725c ra : ffffffff800071c0 sp : ffffffff81c03cb0 [ 0.000000] gp : ffffffff81e30150 tp : ffffffff81c121c0 t0 : 45203a7663736972 [ 0.000000] t1 : 0000000000000072 t2 : 4c45203a76637369 s0 : ffffffff81c03d00 [ 0.000000] s1 : ffffaf83f27a0100 a0 : 0000000000000001 a1 : 0000000000000001 [ 0.000000] a2 : 0000000000476804 a3 : 000000000001feff a4 : 0000000000001fe8 [ 0.000000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 0000000000000010 [ 0.000000] s2 : ffffffff8000415e s3 : 0000000000000004 s4 : ffffffff80004418 [ 0.000000] s5 : 0000000000000162 s6 : 000000000000015e s7 : ffffffff81e3c5c0 [ 0.000000] s8 : ffffffff8000415e s9 : ffffffffff16c7cc s10: 0000000000000018 [ 0.000000] s11: ffffaf83ffa0f7c0 t3 : ffffffff81e4ea77 t4 : ffffffff81e4ea77 [ 0.000000] t5 : ffffffff81e4ea78 t6 : ffffffff81c03a78 [ 0.000000] status: 0000000200000100 badaddr: 0000000000000000 cause: 000000000000000d [ 0.000000] [<ffffffff8000725c>] __patch_insn_write+0x1a2/0x30e [ 0.000000] [<ffffffff80007480>] patch_text_nosync+0x4c/0x8a [ 0.000000] [<ffffffff80003eb0>] riscv_cpufeature_patch_func+0xcc/0x12a [ 0.000000] [<ffffffff80003126>] _apply_alternatives+0x90/0x9c [ 0.000000] [<ffffffff80c03394>] apply_boot_alternatives+0x32/0x11a [ 0.000000] [<ffffffff80c04cba>] setup_arch+0x5f4/0x698 [ 0.000000] [<ffffffff80c0085c>] start_kernel+0x92/0x7e4 [ 0.000000] Code: 9359 cb89 070e 97ba 639c c789 f693 07f6 0696 97b6 (639c) 0513 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Kernel panic - not syncing: Attempted to kill the idle task! [ 0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]--- ``` Signed-off-by: Jia Wang <wangjia@ultrarisc.com> Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
实现了使用 Zacas 和 Zabha 扩展的 [cmp]xchgXX() 宏,并最终利用这些新引入的宏来为 qspinlocks 添加支持,如果硬件不支持Zacas 和 Zabha 或 Ziccrse扩展,则回退到ticket spinlock。
这个补丁的意义:
1、通过使用 Zacas 和 Zabha 扩展,以及优化的 qspinlock 实现,可以显著提高内核在多核环境下的性能,尤其是在高并发场景下
2、该补丁能够在不同硬件配置下灵活选择锁的实现方式,增强了内核对不同硬件平台的兼容性
测试方法:
1、qemu开启zabha和zacas特性
2、内核开启CONFIG_COMBO_SPINLOCKS配置选项
3、内核启动后启动日志打印"Queued spinlock using Zabha: enabled"
4、运行spinlock测试用例